package v2;

import org.bson.Document;

import java.math.BigDecimal;

/**
 * @Author: jiarupc
 * @Date: 2020/12/13
 * @Description:
 */
public class Order {
    private Long id;
    private Long userId;
    private String orderNo;
    private BigDecimal amount;
    private String createTime;
    private String updateTime;

    public static void main(String[] args) throws Exception {
        Order order = new Order();
        order.setId(0L);
        order.setUserId(0L);
        order.setOrderNo("1");
        order.setAmount(new BigDecimal("0"));
        order.setCreateTime("2");
        order.setUpdateTime("3");
        System.out.println("原始数据：" + order);

        Document document = MongoDbUtils.obj2Doc(order);
        System.out.println("转换doc数据：" + document);

        Order order1 = MongoDbUtils.doc2Obj(document, Order.class);
        System.out.println("转换java数据：" + order1);
    }











    // getter/setter
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
}
